var config = require('../../config');
var request = require('../../support').request2;

var serviceConfig = {
  // 获取管家社区列表
  'getProcessedRecord': ['get', '/hk-api/api/json/room/getProcessedRecord'],
  // 报事详情
  'getQrcodeByApplyId': ['get', '/hk-api/api/json/room/getQrcodeByApplyId'],
  // 现金收款
  'cashPay': ['get', '/hk-api/api/json/room/cashPay'],
  // 判断二维码支付状态
  'judeOrderIsPay': ['get', '/hk-api/api/json/room/monitorQrCode']
}

Object.keys(serviceConfig).forEach(function (key) {
  var whost = config.whost
  exports[key] = function (context, data) {
    return request(context, {
      method: serviceConfig[key][0],
      url: whost + serviceConfig[key][1],
      data: data
    }).then(function (res) {
      return res;
    }, function (rej) {
      return {
        fail: true,
        message: rej.message
      };
    })
  }
});